using System;
using UnityEngine;

namespace Light
{
    [Serializable]
    public class Stat
    {
        [field: SerializeField] public float MaxValue { get; set; }

        [SerializeField] private float currentValue;

        public float CurrentValue
        {
            get => currentValue;
            set
            {
                if (value <= MaxValue)
                    currentValue = value;
                else if (value < 0f)
                    currentValue = 0f;
            }
        }

        public void Init()
        {
            CurrentValue = MaxValue;
        }

        public void Increase(float amount)
        {
            currentValue += amount;
        }

        public void Decrease(float amount)
        {
            currentValue -= amount;
        }
    }
}